unit Ftorg;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Buttons;

type
  TTorgF = class(TForm)
    Tedit: TEdit;
    Tbut: TSpeedButton;
    Label1: TLabel;
    BCanc: TSpeedButton;
    procedure TbutClick(Sender: TObject);
    procedure TeditKeyPress(Sender: TObject; var Key: Char);
    procedure FormActivate(Sender: TObject);
    procedure BCancClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  TorgF: TTorgF;

implementation

{$R *.DFM}

uses clunit1,struct;

procedure TTorgF.TbutClick(Sender: TObject);
begin
 if trimleft(trimright(tedit.text))<>'' then torg:=strtoint(tedit.text);
 close;
end;

procedure TTorgF.TeditKeyPress(Sender: TObject; var Key: Char);
begin
 if key in ['0'..'9',#13,#8,#27] then else key:=#0;
 if key=#13 then begin key:=#0;TbutClick(sender);end;
 if key=#27 then begin key:=#0;BCancclick(sender);end;
end;

procedure TTorgF.FormActivate(Sender: TObject);
begin
 Tedit.text:='';
end;

procedure TTorgF.BCancClick(Sender: TObject);
begin
 torg:=65000;
 close;
end;

end.
